From 3ed6f2cad80dce474532e9ab978c491ff76df604 Mon Sep 17 00:00:00 2001 From: mcarton Date: Fri, 15 Jan 2016 17:35:22 +0100 Subject: [PATCH] Remove some useless String::to_string calls MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix some Clippy’s string_to_string warnings. --- src/cargo/ops/cargo_doc.rs | 2 +- src/cargo/ops/cargo_new.rs | 1 - src/cargo/ops/cargo_rustc/context.rs | 4 ++-- src/cargo/ops/registry.rs | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cargo/ops/cargo_doc.rs b/src/cargo/ops/cargo_doc.rs index a6c38c295..ff4e1ec26 100644 --- a/src/cargo/ops/cargo_doc.rs +++ b/src/cargo/ops/cargo_doc.rs @@ -42,7 +42,7 @@ pub fn doc(manifest_path: &Path, bail!("Passing multiple packages and `open` is not supported") } else if options.compile_opts.spec.len() == 1 { try!(PackageIdSpec::parse(&options.compile_opts.spec[0])) - .name().replace("-", "_").to_string() + .name().replace("-", "_") } else { match lib_names.iter().chain(bin_names.iter()).nth(0) { Some(s) => s.to_string(), diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index cf54e87d9..18cfeb88f 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -175,7 +175,6 @@ fn discover_author() -> CargoResult<(String, Option)> { let git_config = GitConfig::open_default().ok(); let git_config = git_config.as_ref(); let name = git_config.and_then(|g| g.get_string("user.name").ok()) - .map(|s| s.to_string()) .or_else(|| env::var("USER").ok()) // unix .or_else(|| env::var("USERNAME").ok()); // windows let name = match name { diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 34f249b53..73bb2ec41 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -134,7 +134,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { lines.next().unwrap().trim() .split('_').skip(1).next().unwrap().to_string() }; - Ok((dylib, exe_suffix.to_string())) + Ok((dylib, exe_suffix)) } /// Prepare this context, ensuring that all filesystem directories are in @@ -244,7 +244,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { None if unit.target.allows_underscores() => { unit.target.name().to_string() } - None => unit.target.crate_name().to_string(), + None => unit.target.crate_name(), } } diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 4865d8d89..3ae68e709 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -366,7 +366,7 @@ pub fn search(query: &str, config: &Config, index: Option) -> CargoResul Some(desc) => { let space = repeat(' ').take(description_margin - name.len()) .collect::(); - name.to_string() + &space + &desc + name + &space + &desc } None => name }; -- 2.30.2